///<reference path="../../node_modules/primeng/components/common/menuitem.d.ts"/>
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';

import { AccordionModule } from 'primeng/accordion';
import { MenuItem } from 'primeng/api';
import { ButtonModule } from 'primeng/button';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import { RouterModule, Routes } from '@angular/router';
import { SharedModule } from './shared/shared.module';

import { AuthGuard } from './shared/guards/auth-guard.service';
import { CatService } from './services/cat.service';
import { UserService } from './services/user.service';
import { AuthService } from './services/auth.service';
import { AuthGuardLogin } from './services/auth-guard-login.service';

import { AppComponent } from './app.component';
import { FrontComponent } from './front/front.component';
import { AdminComponent } from './admin/admin.component';
import { NotFoundComponent } from './not-found/not-found.component';

import { RegisterComponent } from './register/register.component';
import { LoginComponent } from './login/login.component';
import { LogoutComponent } from './logout/logout.component';

import { HomeComponent } from './front/home/home.component';
import { HotelComponent } from './front/hotel/hotel.component';
import { HolidayComponent } from './front/holiday/holiday.component';
import { BlogComponent } from './front/blog/blog.component';
import { HelpComponent } from './front/help/help.component';
import { ForgetPasswordComponent } from './forget-password/forget-password.component';

import { AppFrontMenuComponent } from './components/app-front-menu/app-front-menu.component';
import { AppNavComponent } from './components/app-nav/app-nav.component';

import { DashboardComponent } from './admin/dashboard/dashboard.component';
import { FooterComponent } from './components/footer/footer.component';
import { BackendSideBarComponent } from './components/backend/backend-side-bar/backend-slide-bar.component';
import { ButtonsComponent } from './admin/components/buttons/buttons.component';
import { GridComponent } from './admin/components/grid/grid.component';
import { BackendNavBarComponent } from './components/backend/backend-nav-bar/backend-nav-bar.component';
import { PanelsComponent } from './admin/components/panels/panels.component';
import { SweetAlertComponent } from './admin/components/sweet-alert/sweet-alert.component';

const frontChildRoutes: Routes = [
  { path: 'home', component: HomeComponent },
  { path: 'hotel', component: HotelComponent },
  { path: 'holiday', component: HolidayComponent },
  { path: 'blog', component: BlogComponent },
  { path: 'help', component: HelpComponent },
  { path: '**', redirectTo: '/not-found' }
];

const adminChildRoutes: Routes = [
  { path: 'dashboard', component: DashboardComponent },
  { path: 'component/buttons', component: ButtonsComponent },
  { path: 'component/grid', component: GridComponent },
  { path: 'component/panels', component: PanelsComponent },
  { path: 'component/sweet-alert', component: SweetAlertComponent },
  { path: '**', redirectTo: '/not-found' }
];

const routes: Routes = [
  { path: '', redirectTo: '/front/home', pathMatch: 'full' },
  { path: 'front', component: FrontComponent, children: frontChildRoutes },
  { path: 'admin', component: AdminComponent, children: adminChildRoutes, canActivate: [AuthGuard] },
  { path: 'register', component: RegisterComponent },
  { path: 'login', component: LoginComponent },
  { path: 'forget-password', component: ForgetPasswordComponent },
  { path: 'not-found', component: NotFoundComponent },
  { path: '**', redirectTo: '/not-found' },
];

@NgModule({
  declarations: [
    AppComponent,
    FrontComponent,
    NotFoundComponent,
    RegisterComponent,
    LoginComponent,
    LogoutComponent,
    HomeComponent,
    HotelComponent,
    HolidayComponent,
    BlogComponent,
    HelpComponent,
    ForgetPasswordComponent,
    AppFrontMenuComponent,
    AdminComponent,
    DashboardComponent,
    AppNavComponent,
    FooterComponent,
    BackendSideBarComponent,
    ButtonsComponent,
    GridComponent,
    BackendNavBarComponent,
    PanelsComponent,
    SweetAlertComponent
  ],
  imports: [
    HttpClientModule,
    RouterModule.forRoot(routes),
    SharedModule,
    BrowserModule,
    BrowserAnimationsModule,
    ButtonModule
  ],
  providers: [
    AuthGuard,
    AuthService,
    AuthGuardLogin,
    CatService,
    UserService
  ],
  schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
  bootstrap: [AppComponent]
})
export class AppModule { }
